<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>yield执行权交出</title>
</head>
<body>
<script>
    function *WarriorGenerator() {
        yield 'Samuel';
        yield* NinjaGenerator();
        yield 'Genghis Khan';
    }
    function* NinjaGenerator() {
        yield 'Hattori';
        yield 'Yoshi';
    }
    for(let warrior of WarriorGenerator()) {
        console.log(warrior)
    }
</script>
</body>
</html>
